<!DOCTYPE html>



<html lang="en">

    <style>

        .col-sm-2{width: calc(100%/3);}
        .col-sm-2 select{width: 100% !important;}

        .form-group{padding-left: 0.4rem;padding-top: 0.1rem;padding-right: 0.4rem;display: flex;justify-content: space-between;}



    </style>



<head>



    <meta charset="UTF-8">



    <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge"> -->



    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">



    <title>{:cache('web_name')}</title>



    <link rel="stylesheet" href="__MOBILE__/jscss/index.css">



    <link rel="stylesheet" href="__MOBILE__/jscss/css.css">



    <script type="text/javascript" src="__MOBILE__/jscss/w_rem.js" ></script>



    <script src="__MOBILE__/jscss/jquery.min.js"></script>



<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script></head>



<body style="background: #f8f8f8;">



    <div class="pay_top">



<!--        <div class="pay_top_back"><img src="__MOBILE__/img/a15.png"></div>-->



        <div class="pay_top_title">五进消防</div>



        <div class="pay_top_all">



            <div class="pay_top_all1"><span style="font-weight: bold;">{$info.name}</span><span style="margin-left: 0.6rem;font-weight: bold;">{$info.mobile}</span></div>





            <div class="pay_top_all1 clear"><div class="pay_top_all2_left">取货方式</div><div class="pay_top_all2_right">快递邮寄</div></div>





            <div class="form-group clear">



                <!--                <label class="col-sm-3 control-label">所在地区：</label>-->



                <div class="col-sm-2">



                    <select class="form-control single_select" name="prov"  required>



                        <option value="">请选择省 </option>



                        {volist name="prov_data" id="prov_vo"}



                        <option value="{$prov_vo.name}" >{$prov_vo.name} </option>



                        {/volist}



                    </select>



                </div>



                <div class="col-sm-2">



                    <select class="form-control single_select" name="city" id="city"  required>



                        <option value="">请选择市</option>



                    </select>



                </div>



                <div class="col-sm-2">



                    <select class="form-control single_select" name="area" id="area" required>



                        <option value="">请选择区</option>







                    </select>



                </div>



            </div>



            <div class="pay_top_all1 clear"><div class="pay_top_all2_left">收件地址</div><div class="pay_top_all3_right">



                <textarea name="address" placeholder="请输入收件地址" onkeyup="set_value(this)"></textarea>



            </div></div>



        </div>



    </div>



    <div class="pay_content">



        <div class="pay_content_title"><img src="__MOBILE__/img/a16.png" width="100%" height="100%"></div>



        <div class="index_top3_line"><img src="__MOBILE__/img/a4.png" width="100%" height="100%"></div>



        <div class="order_all">







            {volist name="$info.package" id="vo2"}



            <div class="order_title wtw">



                {eq name="$vo2.package_id" value="0"}



                {$vo2.package_title}-{$vo2.package_total_price}元



                {else/}



                {$vo2.package_title}-{$vo2.package_price}x{$vo2.package_number}={$vo2.package_total_price}元



                {/eq}



            </div>



            {volist name="$vo2.goods_list" id="vo3"}



            <div class="order_content_all clear">



                <div class="more_content_all_left"><img src="{$vo3.single_pic}" width="100%" height="100%"></div>



                <div class="more_content_all_right">



                    <div class="pay_content_all_right1">{$vo3.title}</div>



                    <div class="more_content_all_right2 clear">



                        <div class="pay_content_all_right2a">￥{$vo3.price}</div>



                        <div class="pay_content_all_right2b">×{$vo3.number}</div>



                    </div>



                </div>



            </div>



            {/volist}



            {/volist}



            <div class="order_total clear">



                <div class="order_total1">合计 <span style="font-size: 0.36rem;">¥ <span>{$info.order_price}</span> </span></div>



                <div class="order_total2">共 <span>{$info.goods_count}</span> 个</div>



            </div>



        </div>



    </div>



    <div class="pay_bottom">



        <div class="pay_bottom_btn" onclick="address_update()">立即提交</div>



    </div>



</body>



</html>

<style>

    select{font-size:0.24rem !important;}

</style>

<script>



    function address_update() {







        var prov = $('[name="prov"]').val();



        if (!prov) {



            layer.msg('请选择省');



            return;



        }



        var city = $('[name="city"]').val();



        if (!city) {



            layer.msg('请选择市');



            return;



        }



        var area = $('[name="area"]').val();



        if (!area) {



            layer.msg('请选择区');



            return;



        }



        var address = $('[name="address"]').val();



        if (!address) {



            layer.msg('请填写收件地址');



            return;



        }



        var order_number = "{:input('order_number')}";



        $.ajax({



            type: "POST", //用POST方式传输



            dataType: "json", //数据格式:JSON



            data: {order_number: order_number, address: address,prov:prov,city:city,area:area},



            url: "{:url('update_address')}", //目标地址



            async: false,



            success: function (ret) {



                layer.msg(ret.message);



                if(ret.code == 200){







                    setTimeout(function () {



                        window.location.href = "{:url('order')}";



                    },300);



                }



            }



        });



    }







    var address = localStorage.getItem('address');



    if(address == 'null') address = '';



    $('[name=address]').val(address);







    function set_value(t) {



        var v = $(t).val();



        console.log(v);



        localStorage.setItem('address', v);



    }







    $('[name="prov"]').change(function () {







        var code = $('[name="prov"]').val();



        $.ajax({



            type: "POST", //用POST方式传输



            dataType: "json", //数据格式:JSON



            data: {code: code},



            url: "{:url('ProvCityArea/get_city')}", //目标地址



            async: false,



            beforeSend: function () {



                $('[name="city"]').html('<option value="">请选择市</option>');



                $('[name="area"]').html('<option value="">请选择区</option>');



            },



            success: function (ret) {







                if (ret.code == 200) {







                    $.each(ret.data, function (i, item) {



                        $('[name="city"]').append('<option value="' + item['name'] + '">' + item['name'] + '</option>');



                    });







                }



            }



        });



    });







    $('[name="city"]').change(function () {







        var code = $('[name="city"]').val();



        $.ajax({



            type: "POST", //用POST方式传输



            dataType: "json", //数据格式:JSON



            data: {code: code},



            url: "{:url('ProvCityArea/get_area')}", //目标地址



            async: false,



            beforeSend: function () {



                $('[name="area"]').html('<option value="">请选择区</option>');



            },



            success: function (ret) {







                if (ret.code == 200) {







                    $.each(ret.data, function (i, item) {



                        $('[name="area"]').append('<option value="' + item['name'] + '">' + item['name'] + '</option>');



                    });



                }



            }



        });



    });







    function GetRegion(val,level){



        var $city = $("#city");



        var $area = $("#area");



        $.ajax({



            type: "post",



            url: "{:url('console/common/getRegion')}",



            data: { pcode: val,level:level},



            beforeSend: function() {



                if(level=='1'){



                    $city.html('<option value=""> --请选择市-- </option>');



                    $city.val('');



                }



                $area.html('<option value=""> --请选择区-- </option>');



                $area.val('');



            },



            success: function(data) {



                var dataObj=eval("("+data+")");//转换为json对象







                if(dataObj['code']==1){



                    if(level=='1'){



                        $.each(dataObj['list'], function(i, item) {



                            $city.append('<option value="'+item['code']+'">'+item['name']+'</option>');



                        });



                    }else{



                        $.each(dataObj['list'], function(i, item) {



                            $area.append('<option value="'+item['code']+'">'+item['name']+'</option>');



                        });



                    }



                }



            },



            error: function(err){



                console.log(JSON.stringify(err));



            }



        });



    }



</script>